<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin:0;
      padding:0;
    }
    .box{
      width:400px;
      height:400px;
      background-color: green;
      margin-top:-30px;
     
    }
    .box1{
      width:200px;
      height:200px;
      background-color: red;
      margin-top:50px;
    }
  
  
  </style>
</head>
<body>
  <div class="box">
    <div class="box1">1</div>
  </div>


<!-- 当父子嵌套时候，父和子都设置margin-top  且值为一正一负
 margin-top=-30px+50px

 记住一个口诀  正负取和

 
-->

</body>
</html>